#coding:utf8
#
# Author: CMGS
# Created on 2011-1-19
#

from tinyurl import getTinyUrl
from source import getVaildSources
from core.task import TaskPool as _TaskPool
from libs.debugger import Debugger as _Debugger
from libs.memcached import memcached as _memcached

vaildSources = getVaildSources()
taskPool = _TaskPool()
# init Debugger
_Debugger.init()

# write to memcached
for source in vaildSources:
    url = source.get('source')
    _Debugger.out('init data to memcached')
    # key need considerate key
    tiny = source.get('tiny')
    _memcached.set(tiny, source)
    _Debugger.out('init corn tasks')
    taskPool.fork(url, now = True)

# usage just import this file
